import groovy.time.Duration

class Event {
  User user
  String name
  Integer alertDaysBefore = 1
  Boolean mailAlert = true
  Boolean blogAlert = true
  Date eventDate = new Date() + 1
  Date dateCreated = new Date()
  Date lastUpdated = new Date()

  static belongsTo = [user: User]

  static contraints = {
    user(nullable: false)
    name(nullable: false, maxSize: 64)
    alertDaysBefore(nullable: false, min: 0, max: 365)
    mailAlert(nullable: false)
    blogAlert(nullable: false)
    eventDate(nullable: false)
    dateCreated(nullable: false)
    lastUpdated(nullable: false)
  }

  public String toString() {
    return name
  }

}
